package user

import (
	v1 "gitcode.com/G-YT/ANN/server/api/v1"
	"gitcode.com/G-YT/ANN/server/plugin/geo/api"
	"github.com/gin-gonic/gin"
)

type BaseRouter struct {
}

func (b *BaseRouter) InitBaseRouter(Router *gin.RouterGroup) {
	baseRouter := Router.Group("/base")
	assessRouter := Router.Group("/assess")
	userRouter := Router.Group("/user")
	baseApi := v1.ApiGroupApp.UserApiGroup.BaseApi
	userApi := v1.ApiGroupApp.UserApiGroup.UserApi
	plugApi := api.ApiGroupApp.GeoApi
	exaFileUploadAndDownloadApi := v1.ApiGroupApp.ExampleApiGroup.FileUploadAndDownloadApi
	assessApi := v1.ApiGroupApp.AssessApiGroup.AssessApi
	{
		baseRouter.POST("signUp", baseApi.SignUp)                         // 注册
		baseRouter.POST("signIn", baseApi.SignIn)                         // 登陆
		baseRouter.GET("parseToken", baseApi.ParseToken)                  // 解析token
		baseRouter.POST("authorize", baseApi.Authorize)                   // 授权
		baseRouter.GET("getAppLink", baseApi.GetAppLink)                  // 获取下载链接
		baseRouter.GET("getBAppLink", baseApi.GetBAppLink)                // 获取下载链接
		baseRouter.POST("forgetPassword", baseApi.ForgetPassword)         // 忘记密码
		baseRouter.POST("upload", exaFileUploadAndDownloadApi.UploadFile) // 单文件上传
		baseRouter.GET("getGeos", plugApi.GetGeos)                        // 获取地址列表
		baseRouter.GET("getGeoByWhere", plugApi.GetGeoInfoByWhere)        // 获取地址信息
		baseRouter.GET("getLatelyReport", assessApi.GetLatelyReport)      // 查询最近报告
		baseRouter.GET("getConfigByWhere", baseApi.GetConfigByWhere)      // 根据条件获取APP配置项
	}
	{
		assessRouter.GET("getQuestionResultByID", assessApi.GetQuestionResultByID) // 根据用户ID获取问卷结果
	}
	{
		userRouter.GET("getUserDate", userApi.GetUserData)   // 获取用户信息
		userRouter.PUT("updateUserData", userApi.UpdateUser) // 修改用户信息
		//userRouter.GET("getAccessToken", userApi.GetAccessToken) // 获取微信AccessToken
		userRouter.POST("generateQRCode", userApi.GenerateQRCode)     // 生成小程序二维码
		userRouter.POST("urgentCardQRCode", userApi.UrgentCardQRCode) // 紧急联系人太阳码
	}
}
